//
//  ScoreCommunityListCell.m
//  Supermarket
//
//  Created by qskj-ios on 2019/7/9.
//  Copyright © 2019年 com.qiansheng. All rights reserved.
//

#import "ScoreCommunityListCell.h"

@interface ScoreCommunityListCell ()<UITextFieldDelegate>

@end

@implementation ScoreCommunityListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [self customBorderWithSize:kSeparatorHeight andPosition:UIViewBorderPositionBottom andColor:kSeparatorColor andLeadingInset:15 andTrailingInset:15];
    self.scoreTextField.delegate = self;
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    if (self.scoreEditingDelegate) {
        NSInteger reduceScore = [self.scoreTextField.text integerValue];
        self.scoreEditingDelegate(self, reduceScore);
    }
}

//- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
//    if (self.scoreEditingDelegate) {
//        NSInteger reduceScore = [self.scoreTextField.text integerValue];
//        self.scoreEditingDelegate(self, reduceScore);
//    }
//
//    return YES;
//}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setContentWithScore:(ScoreModel *)model {
    self.scoreTextField.text = @"";
    self.nameLabel.text = model.zx_name;
    self.scoreLabel.text = [NSString stringWithFormat:@"%ld (1积分=1元)", (long)model.point];
}

@end
